SDK-290 Add Expo Config Plugin and Fix Static Linkage Swift Header Import#813
SDK-290 Add Expo Config Plugin and Fix Static Linkage Swift Header Import#813joaodordio wants to merge 2 commits intomasterfrom
Conversation
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
❌ 9 blocking issues (13 total)
|
| * This plugin handles the complex iOS build configuration required for | ||
| * Iterable SDK integration with Expo managed workflows: | ||
| * | ||
| * 1. Disables iOS autolinking for @iterable/react-native-sdk to prevent |
There was a problem hiding this comment.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| import { IterablePluginProps } from './index'; | ||
|
|
||
| /** | ||
| * Disables iOS autolinking for @iterable/react-native-sdk. |
There was a problem hiding this comment.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| }; | ||
|
|
||
| /** | ||
| * Modifies the Expo config to exclude @iterable/react-native-sdk from |
There was a problem hiding this comment.
tsdoc-characters-after-block-tag: The token "@Iterable" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@" [eslint:tsdoc/syntax]
| * | ||
| * Note: autolinking is not in the base ExpoConfig type but is supported at runtime. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export function disableAutolinking<T>(config: T): T { | ||
| // Cast to any for dynamic property access (autolinking not in ExpoConfig types) | ||
| const cfg = config as any; |
| export const withIterablePodfile: ConfigPlugin<IterablePluginProps> = (config, props) => { | ||
| return withDangerousMod(config, [ | ||
| 'ios', | ||
| async (config) => { |
| fs.writeFileSync(podfilePath, contents); | ||
| return config; | ||
| }, | ||
| ]); |
| }; | ||
|
|
||
| /** | ||
| * Ensures the Podfile has use_frameworks! :linkage => :static. |
| return contents.replace(/use_frameworks!\s*(?!\s*:linkage)/, 'use_frameworks! :linkage => :static'); | ||
| } | ||
|
|
||
| return contents; |
| throw new Error( | ||
| 'Could not find a suitable location to inject Iterable pods. ' + | ||
| 'Please ensure your Podfile has a valid target block.' | ||
| ); |

🔹 JIRA Ticket(s) if any
✏️ Description
Problem
Integrating the Iterable React Native SDK in Expo managed workflows requires complex manual configuration:
This leads to recurring build failures:
'Iterable_React_Native_SDK-Swift.h' file not foundSolution
1. Expo Config Plugin
New plugin at
plugin/src/that automates iOS build configuration duringexpo prebuild:Autolinking Exclusion (
withIterableAutolinking.ts):@iterable/react-native-sdkfrom iOS autolinking to prevent duplicate entriesPodfile Transformation (
withIterablePodfile.ts):use_frameworks! :linkage => :staticis set (Expo requirement):linkage => :dynamicoverrideIterableNotificationstarget for push extensionsUsage:
{ "expo": { "plugins": [ ["@iterable/react-native-sdk", { "enableNotificationExtension": true }] ] } }2. Swift Header Import Fix
Updated
RNIterableAPI.mmto use conditional import for static framework builds:3. Podspec Updates
Added to
Iterable-React-Native-SDK.podspec:SWIFT_OBJC_INTERFACE_HEADER_NAMEsettingHEADER_SEARCH_PATHSfor generated Swift header locationFiles Changed
plugin/src/index.tsplugin/src/withIterableAutolinking.tsplugin/src/withIterablePodfile.tsplugin/__tests__/plugin.test.tsios/RNIterableAPI/RNIterableAPI.mmIterable-React-Native-SDK.podspecpackage.jsonTesting
yarn build- SDK and plugin compile successfullyyarn test:plugin- All plugin tests passyarn ios- No Swift header errorsnpx expo prebuild- Correct Podfile outputDependencies
iterable-swift-sdkversion 6.6.5+ with C linkage header fixes